<?php 

if ($_SERVER["REQUEST_METHOD"] == "POST"){
 
    
    $r_input_name = isset($_POST["r_input_name"]) ? $_POST["r_input_name"] : "";
    $r_input_email = isset($_POST["r_input_email"]) ? $_POST["r_input_email"] : ""; 
    $r_input_phone = isset($_POST["r_input_phone"]) ? $_POST["r_input_phone"] : "";
    $r_input_add_info = isset($_POST["r_input_add_info"]) ? $_POST["r_input_add_info"] : "";
 
    $msg = "<h3>Запитване към Правна Кантора Хаджийски  " . $r_input_form_name . " </h3>";
    $msg .= "<p>Име: " . $r_input_name . "</p>";    
    $msg .= "<p>Телефон: " . $r_input_phone . "</p>";
    $msg .= "<p>Имейл: " . $r_input_email . "</p>";    
    $msg .= "<p>Относно: " . $r_input_add_info . "</p>";
    
    // sender, resep, mail() func, serv resp message in mail_config.php    
    $to = "adelina.hadjiiska@gmail.com, isipro@gmail.com";
    $subject =  "Кантора Хаджийски - запитване"; // including the Form Title in the subject
    
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\n";
    $headers .= 'To: <adelina.hadjiiska@gmail.com>' . "\n";
    $headers .= "From: Кантора Хаджийски <adelina.hadjiiska@gmail.com>";
    $headers .= "Cc: Ivan Ivanov <isipro@gmail.com>";
    
    // Mail () execution
    $mail_success = mail($to, $subject, $msg, $headers);

    // success / failure return message
    if ($mail_success){echo "mail success!";}else{"mail() failed";}
    
   
    
    header("Location: http://kantora-hadjiiski.com/zapitvane.php");
}
?>